package com.yh.rent.entity;

import java.util.Set;
import java.util.TreeSet;

import javax.persistence.*;

/**
 * 
 * ��������pojoʵ����  ��Ӧ������  
 *  
 * @author: Administrator  
 * @date�� 2017-10-31 3:05:26 PM  
 * @version 1.0
 */
@Entity
@Table(name = "district")
public class District {
	private Integer id ;//地区id
	private String name ;//地区名称
	private Set<Street> streets = new TreeSet<Street>();
	@Id
	@GeneratedValue(strategy = GenerationType.SEQUENCE , generator = "mygenerator")
	@SequenceGenerator(name = "mygenerator", sequenceName = "district_seq", initialValue = 1 , allocationSize = 1)
	@Column(name="district_id")
	public Integer getId() {
		return id;
	}
	public void setId(Integer id) {
		this.id = id;
	}
	@Column(name = "name")
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	@OneToMany(cascade=CascadeType.ALL ,mappedBy="district")
	public Set<Street> getStreets() {
		return streets;
	}
	public void setStreets(Set<Street> streets) {
		this.streets = streets;
	}
	@Override
	public String toString() {
		return "District [id=" + id + ", name=" + name + ", streets=" + streets + "]";
	}
}
